{extend name="../../admin/view/main"}
{block name="content"}
<form action="{:sysuri()}" method="post" data-auto="true" class="layui-form layui-card">
    <div class="layui-card-body padding-left-40">

        <div class="layui-row layui-col-space15 margin-bottom-5">

            <div class="layui-col-xs4 padding-bottom-0 relative">
                <label class=" block">
                    <span class="help-label"><b>运费</b> Postage</span>
                    <input name="postage_pay"  placeholder="请输入运费" value="{:sysconf('postage_pay')?:'15'}" class="layui-input">
                    <span class="pull-right absolute" style="top: 40px;right:10px;">元</span>
                </label>
            </div>
            <div class="layui-col-xs4 padding-bottom-0 relative">
                <label class=" block">
                    <span class="help-label"><b>包邮下限</b> Money</span>
                    <input name="has_postage_paylimit"  placeholder="请输入包邮下限，默认108元" value="{:sysconf('has_postage_paylimit')?:'108'}" class="layui-input">
                    <span class="pull-right absolute" style="top: 40px;right:10px;">元</span>
                </label>
            </div>
            <div class="layui-col-xs4 padding-bottom-0 ">
                <label class=" block">
                    <span class="help-label"><b>订单可退货周期</b> Reback Time</span>
                    <input name="can_rebacktime"  placeholder="请输入订单可退货周期，默认7天" value="{:sysconf('can_rebacktime')?:'7'}" class="layui-input">
                    <span class="pull-right absolute" style="top: 40px;right:10px;">天</span>
                </label>
            </div>
            <div class="layui-col-xs4 padding-bottom-0 ">
                <label class=" block">
                    <span class="help-label"><b>订单可删除周期</b> Delete Time</span>
                    <input name="can_rebacktime"  placeholder="请输入未支付订单可删除周期，默认7天" value="{:sysconf('can_deletetime')?:'7'}" class="layui-input">
                    <span class="pull-right absolute" style="top: 40px;right:10px;">天</span>
                </label>
            </div>
            <div class="layui-col-xs4 padding-bottom-0 ">
                <label class=" block">
                    <span class="help-label"><b>自动收货周期</b> Finish Time</span>
                    <input name="can_finish_time"  placeholder="请输入订单发货后自动收货周期，默认7天" value="{:sysconf('can_finish_time')?:'7'}" class="layui-input">
                    <span class="pull-right absolute" style="top: 40px;right:10px;">天</span>
                </label>
            </div>
            <div class="layui-col-xs12 padding-bottom-0">
                <label class="relative block">
                    <span class="help-label"><b>订单退货规则</b> Remark</span>
                    <textarea name="order_backrule" style="height:200px!important;overflow-y:scroll;" placeholder="请输入订单退货规则" class="layui-textarea">{:sysconf('order_backrule')?:'订单退货规则'}</textarea>
                </label>
            </div>
            <div class="layui-col-xs12 padding-bottom-0">
                <label class="relative block">
                    <span class="help-label"><b>开发票说明</b> Remark</span>
                    <textarea name="invoiceInstructions" style="height:200px!important;overflow-y:scroll;" placeholder="请输入开发票说明" class="layui-textarea">{:sysconf('invoiceInstructions')?:'开发票说明'}</textarea>
                </label>
            </div>
        </div>
    </div>

    <div class="hr-line-dashed"></div>
    <div class="layui-form-item text-center">
        <button id="order_backrule123" class="layui-btn layui-btn-xs margin-left-15" type="button">预览订单退货规则</button>
        <button id="invoiceInstructions" class="layui-btn layui-btn-xs margin-left-15" type="button">预览开发票说明</button>
        <button class="layui-btn" type="submit">保存配置</button>
    </div>
</form>
<script>
    $(function(){
      require(['ckeditor'], function () {
        window.createEditor('[name=order_backrule]', {height: 150})
        window.createEditor('[name=invoiceInstructions]', {height: 150})
      });

      $("form").parents(".layui-layer-content").css("height","500px")
      $("form").parents(".layui-layer-content").css("overflow-y","scroll")
      $('#order_backrule123').click( function () {
            var contents = $('[name=order_backrule]').val();
            gopreview(contents)
        });
      $('#invoiceInstructions123').click( function () {
            var contents = $('[name=invoiceInstructions]').val();
            gopreview(contents)
        });
    })
    function gopreview(contents){
        $.ajax({
                url:'/index/index/preview',
                type:'POST',
                data:{
                    'content':contents
                },
                success:function(data){
                    if(data.code == 1){
                        layui.layer.open({
                            type: 1, shade: false, title: '预览',
                            content: '<div class="text-center padding-20"><img src="'+data.data+'" width="200"></div>'
                        });
                    }else{
                        layer.msg(data.info);
                        return false;
                    }
                }
            })
    }
</script>

{/block}
